home *** CD-ROM | disk | FTP | other *** search
/ PC Media 7 / PC MEDIA CD07.iso / share / prog / cm / cmbdict.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-09-06  |  1.7 KB  |  38 lines

  1. // CmBDict.h
  2. // -----------------------------------------------------------------
  3. // Compendium - C++ Container Class Library
  4. // Copyright (C) 1992-1994, Glenn M. Poorman, All rights reserved
  5. // -----------------------------------------------------------------
  6. // BTree dictionary definition.
  7. // -----------------------------------------------------------------
  8.  
  9. #ifndef _CMBDICT_H
  10. #define _CMBDICT_H
  11.  
  12. #include <cm/include/cmbtree.h>
  13. #include <cm/include/cmassoc.h>
  14.  
  15. class CmBTreeDictionary : public CmBTree {            // Dictionary definition.
  16. public:
  17.   CmBTreeDictionary(unsigned = 10);                   // Default constructor.
  18.   CmBTreeDictionary(const CmBTreeDictionary&);        // Copy constructor.
  19.  ~CmBTreeDictionary();                                // Destructor.
  20.  
  21.   CmBTreeDictionary& operator=(const CmBTreeDictionary&); // Assignment op.
  22.  
  23.   Bool           add         (CmObject*);             // Add association.
  24.   Bool           add         (CmObject*, CmObject*);  // Add key and object.
  25.   CmObject*      lookup      (CmObject*) const;       // Key from key.
  26.   CmObject*      lookupObject(CmObject*) const;       // Object from key.
  27.   CmAssociation* lookupAssoc (CmObject*) const;       // Association from key.
  28.   Bool           replace     (CmObject*, CmObject*);  // Replace object at key.
  29.   Bool           remove      (CmObject*);             // Remove key and object.
  30.   Bool           contains    (CmObject*) const;       // Key in dictionary?
  31.   unsigned       occurrences (CmObject*) const;       // Occurrences of key.
  32.   void           removeAll   ();                      // Remove all objects.
  33.  
  34.   CMOBJECT_DEFINE(CmBTreeDictionary, CmBTree)         // Define object funcs.
  35. };
  36.  
  37. #endif
  38.